function result = g(tau, r, r_, theta, s_)
%G This function gets 5 arguments (tau, r, r', theta, s') and returns g(tau, r, r', theta, s')
%   This function implements the following formula:
%   g(tau, r, r_, theta) = 
%      i/((2*pi*h)^2) * (exp(i *[]) / delta^2) * sign(delta)

% Use global parameter:
global h_;
global n;

DBG('disp([''tau='' num2str(tau) ''; r_='' num2str(r_) ''; r='' num2str(r) ''; theta='' num2str(theta) ''; s_='' num2str(s_)])');

delta = s_ ./ n;
temp1 = 1i ./ ((2 .* pi .* h_) .^2);
temp2_1 = ((tau.^2 - (r.^2 + r_.^2 - 2 .* r .* r_ .* cos(theta))) ./ (2 .* h_ .* delta));
temp2_2 = tau .* phi0(r, r_, theta);
temp2 = exp(1i .* (temp2_1 + temp2_2));

result = temp1 .* (temp2 ./ delta.^2) .* sign(delta); 

DBG('disp([''g res='' num2str(result)])');

end
